package com.yang.frost.blueberry.controller;

import com.yang.frost.blueberry.config.annotation.Log;
import com.yang.frost.blueberry.params.BasePageOrderParam;
import com.yang.frost.blueberry.params.BaseParam;
import com.yang.frost.blueberry.params.LoginParam;
import com.yang.frost.blueberry.params.UmsUserParam;
import com.yang.frost.blueberry.service.UmsUserService;
import com.yang.frost.blueberry.util.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;

/**
 * @author 10296
 * @date 2021/4/11
 * @Description: 用户管理
 */
@Controller
@Api(value = "用户管理", description = "用户管理")
@RequestMapping("/umsApi/umsUser")
public class UmsUserController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private UmsUserService umsUserService;

    @Log("添加用户")
    @PostMapping("/insertSysUser")
    @ApiOperation(value = "添加用户", notes = "添加用户信息")
    public ApiResult insertSysUser(@Validated @RequestBody UmsUserParam userParam, HttpServletResponse response) throws Exception {

        return umsUserService.insertSysUser(userParam);
    }

    @Log("删除用户")
    @PostMapping("/deleteSysUser")
    @ApiOperation(value = "删除用户", notes = "删除用户信息")
    public ApiResult deleteSysUser(@Validated @RequestBody BaseParam baseParam, HttpServletResponse response) throws Exception {

        return umsUserService.deleteSysUser(baseParam);
    }

    @Log("查询用户信息列表")
    @PostMapping("/qryUserList")
    @ApiOperation(value = "查询用户信息列表", notes = "查询用户信息列表")
    public ApiResult qryUserList(@Validated @RequestBody BasePageOrderParam orderParam, HttpServletResponse response) throws Exception {

        return ApiResult.ok("查询成功");
    }

    @Log("更新用户信息")
    @PostMapping("/updateSysUser")
    @ApiOperation(value = "修改用户信息", notes = "修改用户信息")
    public ApiResult updateSysUser(@Validated @RequestBody UmsUserParam userParam, HttpServletResponse response) throws Exception {

        return ApiResult.ok("查询成功");
    }


}
